package com.mz361.stdapi.repository;

import com.mz361.modules.system.repository.BaseRepository;
import com.mz361.stdapi.domain.StandardTable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface StandardTableRepository extends BaseRepository<StandardTable, String> {
    @Query(value = "SELECT * from tb_standard_0821 where fn_HavePDF='1'  and fn_file is null", nativeQuery = true)
    List<StandardTable> findAllByNofile();

    List<StandardTable> findAll();

    @Query(value = "SELECT * from tb_standard_0821 o where o.status<>3 and o.fn_stand_class=?1 order by o.id asc ", countQuery = "select count(o.id) from tb_standard_0821 o where o.status<>3 and o.fn_stand_class=?1", nativeQuery = true)
    Page<StandardTable> findAllByStandClass(String standClass, Pageable pageable);

}
